#!/bin/bash
#set -e

# 定义scp要传输的源路径和目标路径
#SCRIPT_FILE="cleanup-scripts/clean-common-logs.sh"
SCRIPT_FILE="clean-disk-space-docker"
TARGET_PATH="/opt/app"
echo "是否将$SCRIPT_FILE传输到"
cat servers.txt
echo "的$TARGET_PATH目录"
read -p "输入选项(y/n): " num
if [[ $num != "y" ]]; then
    echo "取消执行"
    exit
fi

while IFS= read -r server
do
    # 使用 scp 命令传输脚本文件到远程服务器
    echo "-------------------------------------"
    scp -o StrictHostKeyChecking=no -r "$SCRIPT_FILE" "$server:$TARGET_PATH"

done < servers.txt
